package com.yunji.cabinet.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yunji.cabinet.bo.FillCargoQueryBO;
import com.yunji.cabinet.bo.FillCargoSelectBO;
import com.yunji.cabinet.context.convert.MaintainConvert;
import com.yunji.cabinet.dao.IFillCargoInfoDao;
import com.yunji.cabinet.domain.FillCargoInfoDO;
import com.yunji.cabinet.dto.FillCargoDTO;
import com.yunji.cabinet.vo.MaintainDetailVO;
import com.yunji.common.utils.bean.BeanUtils;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Project: yunji-coffee
 * @Package: com.yunji.cabinet.service
 * @Title: FillCargoService
 * <p>
 * History:
 * Date                     Version     Author          Summary
 * ============================================================
 * 2024-11-01 15:12:55      V1.0        HuaAo       新建类
 */
@Service
public class FillCargoInfoService {

    @Resource
    IFillCargoInfoDao fillCargoInfoDao;

    public boolean create(FillCargoInfoDO fillCargoInfo) {
        return fillCargoInfoDao.save(fillCargoInfo);
    }

    public List<MaintainDetailVO> search(FillCargoQueryBO param) {
        return MaintainConvert.convertDetailVO(fillCargoInfoDao.search(param));
    }

    public List<FillCargoInfoDO> search(FillCargoDTO param) {
        return fillCargoInfoDao.pageList(param, new LambdaQueryWrapper<FillCargoInfoDO>()
                .eq(BeanUtils.isNotNull(param.getMaintainId()), FillCargoInfoDO::getMaintainId, param.getMaintainId()));
    }

    public FillCargoInfoDO select(FillCargoSelectBO bo) {
        return fillCargoInfoDao.select(bo);
    }
}